Optimal. Leaf size=263 \[ -\frac {\left (4 a A b-6 a^2 B-b^2 B\right ) x}{2 b^4}+\frac {2 a^2 \left (2 a^2 A b-3 A b^3-3 a^3 B+4 a b^2 B\right ) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} b^4 (a+b)^{3/2} d}+\frac {\left (2 a^2 A b-A b^3-3 a^3 B+2 a b^2 B\right ) \sin (c+d x)}{b^3 \left (a^2-b^2\right ) d}-\frac {\left (2 a A b-3 a^2 B+b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 b^2 \left (a^2-b^2\right ) d}+\frac {a (A b-a B) \cos ^2(c+d x) \sin (c+d x)}{b \left (a^2-b^2\right ) d (a+b \cos (c+d x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.44, antiderivative size = 263, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.194, Rules used = {3068, 3128,
3102, 2814, 2738, 211} \begin {gather*} \frac {a (A b-a B) \sin (c+d x) \cos ^2(c+d x)}{b d \left (a^2-b^2\right ) (a+b \cos (c+d x))}-\frac {\left (-3 a^2 B+2 a A b+b^2 B\right ) \sin (c+d x) \cos (c+d x)}{2 b^2 d \left (a^2-b^2\right )}-\frac {x \left (-6 a^2 B+4 a A b-b^2 B\right )}{2 b^4}+\frac {2 a^2 \left (-3 a^3 B+2 a^2 A b+4 a b^2 B-3 A b^3\right ) \text {ArcTan}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{b^4 d (a-b)^{3/2} (a+b)^{3/2}}+\frac {\left (-3 a^3 B+2 a^2 A b+2 a b^2 B-A b^3\right ) \sin (c+d x)}{b^3 d \left (a^2-b^2\right )} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 2738
Rule 2814
Rule 3068
Rule 3102
Rule 3128
Rubi steps
\begin {align*} \int \frac {\cos ^3(c+d x) (A+B \cos (c+d x))}{(a+b \cos (c+d x))^2} \, dx &=\frac {a (A b-a B) \cos ^2(c+d x) \sin (c+d x)}{b \left (a^2-b^2\right ) d (a+b \cos (c+d x))}-\frac {\int \frac {\cos (c+d x) \left (-2 a (A b-a B)+b (A b-a B) \cos (c+d x)+\left (2 a A b-3 a^2 B+b^2 B\right ) \cos ^2(c+d x)\right )}{a+b \cos (c+d x)} \, dx}{b \left (a^2-b^2\right )}\\ &=-\frac {\left (2 a A b-3 a^2 B+b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 b^2 \left (a^2-b^2\right ) d}+\frac {a (A b-a B) \cos ^2(c+d x) \sin (c+d x)}{b \left (a^2-b^2\right ) d (a+b \cos (c+d x))}-\frac {\int \frac {a \left (2 a A b-3 a^2 B+b^2 B\right )-b \left (2 a A b-a^2 B-b^2 B\right ) \cos (c+d x)-2 \left (2 a^2 A b-A b^3-3 a^3 B+2 a b^2 B\right ) \cos ^2(c+d x)}{a+b \cos (c+d x)} \, dx}{2 b^2 \left (a^2-b^2\right )}\\ &=\frac {\left (2 a^2 A b-A b^3-3 a^3 B+2 a b^2 B\right ) \sin (c+d x)}{b^3 \left (a^2-b^2\right ) d}-\frac {\left (2 a A b-3 a^2 B+b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 b^2 \left (a^2-b^2\right ) d}+\frac {a (A b-a B) \cos ^2(c+d x) \sin (c+d x)}{b \left (a^2-b^2\right ) d (a+b \cos (c+d x))}-\frac {\int \frac {a b \left (2 a A b-3 a^2 B+b^2 B\right )+\left (a^2-b^2\right ) \left (4 a A b-6 a^2 B-b^2 B\right ) \cos (c+d x)}{a+b \cos (c+d x)} \, dx}{2 b^3 \left (a^2-b^2\right )}\\ &=-\frac {\left (4 a A b-6 a^2 B-b^2 B\right ) x}{2 b^4}+\frac {\left (2 a^2 A b-A b^3-3 a^3 B+2 a b^2 B\right ) \sin (c+d x)}{b^3 \left (a^2-b^2\right ) d}-\frac {\left (2 a A b-3 a^2 B+b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 b^2 \left (a^2-b^2\right ) d}+\frac {a (A b-a B) \cos ^2(c+d x) \sin (c+d x)}{b \left (a^2-b^2\right ) d (a+b \cos (c+d x))}+\frac {\left (a^2 \left (2 a^2 A b-3 A b^3-3 a^3 B+4 a b^2 B\right )\right ) \int \frac {1}{a+b \cos (c+d x)} \, dx}{b^4 \left (a^2-b^2\right )}\\ &=-\frac {\left (4 a A b-6 a^2 B-b^2 B\right ) x}{2 b^4}+\frac {\left (2 a^2 A b-A b^3-3 a^3 B+2 a b^2 B\right ) \sin (c+d x)}{b^3 \left (a^2-b^2\right ) d}-\frac {\left (2 a A b-3 a^2 B+b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 b^2 \left (a^2-b^2\right ) d}+\frac {a (A b-a B) \cos ^2(c+d x) \sin (c+d x)}{b \left (a^2-b^2\right ) d (a+b \cos (c+d x))}+\frac {\left (2 a^2 \left (2 a^2 A b-3 A b^3-3 a^3 B+4 a b^2 B\right )\right ) \text {Subst}\left (\int \frac {1}{a+b+(a-b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{b^4 \left (a^2-b^2\right ) d}\\ &=-\frac {\left (4 a A b-6 a^2 B-b^2 B\right ) x}{2 b^4}+\frac {2 a^2 \left (2 a^2 A b-3 A b^3-3 a^3 B+4 a b^2 B\right ) \tan ^{-1}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{3/2} b^4 (a+b)^{3/2} d}+\frac {\left (2 a^2 A b-A b^3-3 a^3 B+2 a b^2 B\right ) \sin (c+d x)}{b^3 \left (a^2-b^2\right ) d}-\frac {\left (2 a A b-3 a^2 B+b^2 B\right ) \cos (c+d x) \sin (c+d x)}{2 b^2 \left (a^2-b^2\right ) d}+\frac {a (A b-a B) \cos ^2(c+d x) \sin (c+d x)}{b \left (a^2-b^2\right ) d (a+b \cos (c+d x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.13, size = 184, normalized size = 0.70 \begin {gather*} \frac {2 \left (-4 a A b+6 a^2 B+b^2 B\right ) (c+d x)-\frac {8 a^2 \left (-2 a^2 A b+3 A b^3+3 a^3 B-4 a b^2 B\right ) \tanh ^{-1}\left (\frac {(a-b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a^2+b^2}}\right )}{\left (-a^2+b^2\right )^{3/2}}+4 b (A b-2 a B) \sin (c+d x)+\frac {4 a^3 b (A b-a B) \sin (c+d x)}{(a-b) (a+b) (a+b \cos (c+d x))}+b^2 B \sin (2 (c+d x))}{4 b^4 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.41, size = 267, normalized size = 1.02
method | result | size |
derivativedivides | \(\frac {\frac {2 a^{2} \left (\frac {a \left (A b -a B \right ) b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b \right )}+\frac {\left (2 A \,a^{2} b -3 A \,b^{3}-3 a^{3} B +4 B a \,b^{2}\right ) \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b^{4}}-\frac {2 \left (\frac {\left (-A \,b^{2}+2 B a b +\frac {1}{2} B \,b^{2}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-A \,b^{2}+2 B a b -\frac {1}{2} B \,b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {\left (4 A a b -6 B \,a^{2}-B \,b^{2}\right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}\right )}{b^{4}}}{d}\) | \(267\) |
default | \(\frac {\frac {2 a^{2} \left (\frac {a \left (A b -a B \right ) b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (a^{2}-b^{2}\right ) \left (a \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-b \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+a +b \right )}+\frac {\left (2 A \,a^{2} b -3 A \,b^{3}-3 a^{3} B +4 B a \,b^{2}\right ) \arctan \left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{\left (a -b \right ) \left (a +b \right ) \sqrt {\left (a -b \right ) \left (a +b \right )}}\right )}{b^{4}}-\frac {2 \left (\frac {\left (-A \,b^{2}+2 B a b +\frac {1}{2} B \,b^{2}\right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (-A \,b^{2}+2 B a b -\frac {1}{2} B \,b^{2}\right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{2}}+\frac {\left (4 A a b -6 B \,a^{2}-B \,b^{2}\right ) \arctan \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{2}\right )}{b^{4}}}{d}\) | \(267\) |
risch | \(-\frac {2 x A a}{b^{3}}+\frac {3 x B \,a^{2}}{b^{4}}+\frac {B x}{2 b^{2}}+\frac {i B \,{\mathrm e}^{-2 i \left (d x +c \right )}}{8 b^{2} d}+\frac {i {\mathrm e}^{i \left (d x +c \right )} a B}{b^{3} d}-\frac {i B \,{\mathrm e}^{2 i \left (d x +c \right )}}{8 b^{2} d}-\frac {i {\mathrm e}^{i \left (d x +c \right )} A}{2 b^{2} d}+\frac {i {\mathrm e}^{-i \left (d x +c \right )} A}{2 b^{2} d}-\frac {2 i a^{3} \left (-A b +a B \right ) \left (a \,{\mathrm e}^{i \left (d x +c \right )}+b \right )}{b^{4} \left (a^{2}-b^{2}\right ) d \left (b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 a \,{\mathrm e}^{i \left (d x +c \right )}+b \right )}-\frac {i {\mathrm e}^{-i \left (d x +c \right )} a B}{b^{3} d}-\frac {2 a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) A}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{3}}+\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) A}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d b}+\frac {3 a^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{4}}-\frac {4 a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{2}}+\frac {2 a^{4} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) A}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{3}}-\frac {3 a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) A}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d b}-\frac {3 a^{5} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{4}}+\frac {4 a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-a \sqrt {-a^{2}+b^{2}}}{b \sqrt {-a^{2}+b^{2}}}\right ) B}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) d \,b^{2}}\) | \(918\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.43, size = 965, normalized size = 3.67 \begin {gather*} \left [\frac {{\left (6 \, B a^{6} b - 4 \, A a^{5} b^{2} - 11 \, B a^{4} b^{3} + 8 \, A a^{3} b^{4} + 4 \, B a^{2} b^{5} - 4 \, A a b^{6} + B b^{7}\right )} d x \cos \left (d x + c\right ) + {\left (6 \, B a^{7} - 4 \, A a^{6} b - 11 \, B a^{5} b^{2} + 8 \, A a^{4} b^{3} + 4 \, B a^{3} b^{4} - 4 \, A a^{2} b^{5} + B a b^{6}\right )} d x - {\left (3 \, B a^{6} - 2 \, A a^{5} b - 4 \, B a^{4} b^{2} + 3 \, A a^{3} b^{3} + {\left (3 \, B a^{5} b - 2 \, A a^{4} b^{2} - 4 \, B a^{3} b^{3} + 3 \, A a^{2} b^{4}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) + {\left (2 \, a^{2} - b^{2}\right )} \cos \left (d x + c\right )^{2} - 2 \, \sqrt {-a^{2} + b^{2}} {\left (a \cos \left (d x + c\right ) + b\right )} \sin \left (d x + c\right ) - a^{2} + 2 \, b^{2}}{b^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + a^{2}}\right ) - {\left (6 \, B a^{6} b - 4 \, A a^{5} b^{2} - 10 \, B a^{4} b^{3} + 6 \, A a^{3} b^{4} + 4 \, B a^{2} b^{5} - 2 \, A a b^{6} - {\left (B a^{4} b^{3} - 2 \, B a^{2} b^{5} + B b^{7}\right )} \cos \left (d x + c\right )^{2} + {\left (3 \, B a^{5} b^{2} - 2 \, A a^{4} b^{3} - 6 \, B a^{3} b^{4} + 4 \, A a^{2} b^{5} + 3 \, B a b^{6} - 2 \, A b^{7}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{4} b^{5} - 2 \, a^{2} b^{7} + b^{9}\right )} d \cos \left (d x + c\right ) + {\left (a^{5} b^{4} - 2 \, a^{3} b^{6} + a b^{8}\right )} d\right )}}, \frac {{\left (6 \, B a^{6} b - 4 \, A a^{5} b^{2} - 11 \, B a^{4} b^{3} + 8 \, A a^{3} b^{4} + 4 \, B a^{2} b^{5} - 4 \, A a b^{6} + B b^{7}\right )} d x \cos \left (d x + c\right ) + {\left (6 \, B a^{7} - 4 \, A a^{6} b - 11 \, B a^{5} b^{2} + 8 \, A a^{4} b^{3} + 4 \, B a^{3} b^{4} - 4 \, A a^{2} b^{5} + B a b^{6}\right )} d x - 2 \, {\left (3 \, B a^{6} - 2 \, A a^{5} b - 4 \, B a^{4} b^{2} + 3 \, A a^{3} b^{3} + {\left (3 \, B a^{5} b - 2 \, A a^{4} b^{2} - 4 \, B a^{3} b^{3} + 3 \, A a^{2} b^{4}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \cos \left (d x + c\right ) + b}{\sqrt {a^{2} - b^{2}} \sin \left (d x + c\right )}\right ) - {\left (6 \, B a^{6} b - 4 \, A a^{5} b^{2} - 10 \, B a^{4} b^{3} + 6 \, A a^{3} b^{4} + 4 \, B a^{2} b^{5} - 2 \, A a b^{6} - {\left (B a^{4} b^{3} - 2 \, B a^{2} b^{5} + B b^{7}\right )} \cos \left (d x + c\right )^{2} + {\left (3 \, B a^{5} b^{2} - 2 \, A a^{4} b^{3} - 6 \, B a^{3} b^{4} + 4 \, A a^{2} b^{5} + 3 \, B a b^{6} - 2 \, A b^{7}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{2 \, {\left ({\left (a^{4} b^{5} - 2 \, a^{2} b^{7} + b^{9}\right )} d \cos \left (d x + c\right ) + {\left (a^{5} b^{4} - 2 \, a^{3} b^{6} + a b^{8}\right )} d\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.44, size = 338, normalized size = 1.29 \begin {gather*} \frac {\frac {4 \, {\left (3 \, B a^{5} - 2 \, A a^{4} b - 4 \, B a^{3} b^{2} + 3 \, A a^{2} b^{3}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (-2 \, a + 2 \, b\right ) + \arctan \left (-\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{{\left (a^{2} b^{4} - b^{6}\right )} \sqrt {a^{2} - b^{2}}} - \frac {4 \, {\left (B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - A a^{3} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (a^{2} b^{3} - b^{5}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + a + b\right )}} + \frac {{\left (6 \, B a^{2} - 4 \, A a b + B b^{2}\right )} {\left (d x + c\right )}}{b^{4}} - \frac {2 \, {\left (4 \, B a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 2 \, A b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + B b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 4 \, B a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, A b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2} b^{3}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 9.21, size = 2500, normalized size = 9.51 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________